package com.alks.function.mapper;

import com.alks.entity.data.entity.SdCompany;
import com.alks.entity.data.entity.dispatch.Vendor;
import com.alks.entity.data.entity.imes.Brand;
import com.alks.entity.data.response.ResponseInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.mapstruct.Mapper;

import java.util.List;

@Mapper
public interface SdCompanyMapper extends BaseMapper<SdCompany> {


    /**
     * 查询所有
     * @return
     */
    @Select("select COMPANY_ID,ABBR_NAME,CHI_NAME,ENG_NAME,CHI_ADDR,ENG_ADDR,TELPHONE,FAX_NO,WEB_ADDR,EMAIL,POST_CODE from SD_COMPANY")
    List<SdCompany> FindAll();

    /**
     * 修改
     * @param sdCompany
     */
    void UpdateWithCompanyInfo(SdCompany sdCompany);

    /**
     * 公司所有数据根据id
     * @return
     */
    @Select("select COMPANY_ID,ABBR_NAME,CHI_NAME,ENG_NAME,CHI_ADDR,ENG_ADDR,TELPHONE,FAX_NO,WEB_ADDR,EMAIL,POST_CODE from SD_COMPANY where COMPANY_ID = #{companyId}")
    SdCompany findAllBYCompanyId(String companyId);

    @Select("select COMPANY_ID,ABBR_NAME,CHI_NAME,ENG_NAME,CHI_ADDR,ENG_ADDR,TELPHONE,FAX_NO,WEB_ADDR,EMAIL,POST_CODE,DELIVERY_ADDR,TITLE_NAME from SD_COMPANY where COMPANY_ID = #{companyId}")
    SdCompany findPurCompanyInfo(String companyId);

    Vendor selectOutVendorByName(@Param("companyId") String companyId, @Param("vendorAbbr") String vendorAbbr, @Param("vendorType") String g17);

    int queryBrandUsedInSampleLotCount(String brandName);

    ResponseInfo deleteByRowId(Brand brand);

    String getDispatchDept(String companyId);
}
